<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue-组件通信父组件向子组件传递数据</title>
</head>
<body>
    <div id="app">
        <cpn v-bind:cmovies="movies" :cmessage="message"></cpn>
        <!-- 如果不使用v-bind movies将被当做字符串直接传过去 -->
        <!-- <cpn cmovies="movies" cmessage="message"></cpn> -->
    </div>
    <template id="cpn">
        <div>
            <h2>{{cmovies}}</h2>
            <ul>
                <li v-for="item in cmovies">{{item}}</li>
            </ul>
            <h2>{{cmessage}}</h2>
        </div>
    </template>
    <script src="./js/vue.min.js"></script>
    <script>
        // 父组件传子组件\
        const cpn ={
            template:'#cpn',
            props:['cmovies','cmessage'],
            data() {
                return{

                }
            }
        }
        const app = new Vue({
            el:'#app',
            data:{
                message:'hello',
                movies:['海王','美人鱼','海贼王','鲛人泪']
            },
            components:{
                cpn
            }
        })
    </script>
</body>
</html>